package com.ywjt.platformbusiness.widget;

import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.ywjt.platformbusiness.R;
import com.ywjt.platformbusiness.base.BaseBottomDialog;


public class PayTypeBottomDialog extends BaseBottomDialog {

    private LinearLayout llAliPay;
    private LinearLayout llBankCard;
    private TextView tvSure;

    private ClickListenerInterface clickListenerInterface;

    public interface ClickListenerInterface {
        void alipay();

        void bank();
        void sure();
    }

    public PayTypeBottomDialog() {
    }

    @Override
    public int getLayoutRes() {
        return R.layout.dialog_pay_type;
    }

    @Override
    public void bindView(View v) {
        llAliPay = v.findViewById(R.id.llAliPay);
        llBankCard = v.findViewById(R.id.llBankCard);
        tvSure = v.findViewById(R.id.tvSure);
        llAliPay.setOnClickListener(new clickListener());
        llBankCard.setOnClickListener(new clickListener());
        tvSure.setOnClickListener(new clickListener());
    }

    public void setClicklistener(ClickListenerInterface clickListener) {
        clickListenerInterface = clickListener;
    }

    private class clickListener implements View.OnClickListener {

        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.llAliPay:
                    dismiss();
                    clickListenerInterface.alipay();
                    break;
                case R.id.llBankCard:
                    dismiss();
                    clickListenerInterface.bank();
                    break;
                case R.id.tvCancel:
                    clickListenerInterface.sure();
                    break;
                default:
                    break;
            }
        }
    }
}
